package com.shop.controller;


import com.shop.annotation.RequireRoles;
import com.shop.model.vo.Rsp;
import com.shop.service.SystemInfoService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RestController
@AllArgsConstructor
@RequestMapping("system")
@Slf4j
public class SystemInfoController {

    private final SystemInfoService systemInfoService;

    @RequireRoles(roles = {"platform"})
    @GetMapping("/getSystemInfo")
    public Rsp getSystemInfo() throws Exception {
        return systemInfoService.getSystemInfo();
    }


    @RequireRoles(roles = {"platform"})
    @GetMapping("/gcJvmMem")
    public void gcJvmMem() {
        System.gc();
    }

}
